<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    // consignee：收货人

    // consignor：发货人

    // courier：快递员


    function consignee(n){
        this.name = n;
    }

    function consignor(n, c){
        this.name = n;
        this.consignee = c;
        this.send = function(msg){
            console.log(`${this.name}把${msg}发给了${this.consignee.name}`)
        }
    }

    function courier(c1, c2){
        const c = new consignor(c1, c2);
        this.message = [];
        this.send = function(msg){
            this.message.push({
                收件人:c2.name,
                发件人:c1,
                物品:msg,
                发送时间:Date.now()
            })
            c.send(msg);
        }
    }

    const c = new consignee('李四');

    // const c2 = new consignor("张三", c);
    // c2.send("手机");

    const c3 = new courier("张三", c);
    c3.send("手机");

    console.log(c3);
    console.log(c3.message);

    
</script>
</html>